<template>
  <s-layout :bgStyle="{ color: '#090909' }">
    <image class="commodity" src="@/static/img/officerDetail/img-3.png"></image>
    <view class="marketDetail">
      <view class="product">
        <view class="product-t">米其林汽车轮胎</view>
        <view class="product-b ss-flex ss-col-center">
          <view class="ss-flex">
            <view class="text-1">系列：</view>
            <view class="text-2">数字形象</view>
          </view>
          <view class="ss-flex">
            <view class="text-1">限量/</view>
            <view class="text-2">50000</view>
          </view>
        </view>
      </view>
      <view class="issuer ss-flex">
        <image class="issuer-l" src="@/static/img/officerDetail/img-1.png"></image>
        <view class="issuer-r">
          <view class="text-1">发行方</view>
          <view class="text-2">九丝城宇宙</view>
        </view>
      </view>
      <view class="transaction ss-flex ss-col-center ss-row-between" @tap="sheep.$router.go('/pages/inherit/transactionTrend',)">
        <view class="transaction-l ss-flex ">
          <image class="transaction-l-img" src="@/static/img/icon-transaction.png"></image>
          <view>成交趋势</view>
        </view>
        <image class="transaction-r" src="@/static/img/icon-right.png"></image>
      </view>
      <view class="product-content">
        <view class="tab">
          <view>商品详情</view>
        </view>
        <view class="productDetails">
          <image mode="widthFix" src="@/static/img/pro-icon-1.png"></image>
        </view>
      </view>
    </view>
    <su-fixed bottom :val="0" :isInset="false">
      <view class="marketDetail-footer ss-flex ss-col-center ss-row-between">
        <view class="footer-left">
          <button>出售</button>
        </view>
        <view class="footer-right">
          <button @tap="state.showCoupon = true">我想要</button>
        </view>
      </view>
    </su-fixed>
    <PopupLivelisting v-model="state.couponInfo"
                      :show="state.showCoupon"
                      @confirm="onConfirm"
                      @close="state.showCoupon = false"></PopupLivelisting>
    <PopupPurchaseInformation v-model="state.couponInfo1"
                      :show="state.showCoupon1"
                      @confirm="onConfirm1"
                      @close="state.showCoupon1 = false"></PopupPurchaseInformation>
    <PopupBuyNow v-model="state.couponInfo2"
                      :show="state.showCoupon2"
                      @confirm="onConfirm2"
                      @close="state.showCoupon2 = false"></PopupBuyNow>
  </s-layout>
</template>

<script setup>
  import { computed, ref, reactive, getCurrentInstance, onMounted, nextTick } from 'vue';
  import sheep from '@/sheep';
import PopupLivelisting from  './components/popup-livelisting/index.vue'
import PopupBuyNow from  './components/popup-buyNow/index.vue'
import PopupPurchaseInformation from  './components/popup-purchaseInformation/index.vue'

  let active = ref(0);
  const state = reactive({
    showCoupon: false,
    couponInfo: [],
    showDiscount: false,

    showCoupon1: false,
    couponInfo1: [],
    showDiscount1: false,

    showCoupon2: false,
    couponInfo2: [],
    showDiscount2: false,
  });

  function onConfirm() {
    state.showCoupon = false;
    state.showCoupon1 = true;
    // sheep.$router.go('/pages/inherit/successful');
    // if (!state.orderPayload.address_id && state.orderInfo.need_address === 1) {
    //   sheep.$helper.toast('请选择收货地址');
    //   return;
    // }
    //
    // if (exchangeNow.value) {
    //   uni.showModal({
    //     title: '提示',
    //     content: '确定使用积分立即兑换?',
    //     cancelText: '再想想',
    //     success: async function(res) {
    //       if (res.confirm) {
    //         submitOrder();
    //       }
    //     },
    //   });
    // } else {
    //   submitOrder();
    // }
  }
  function onConfirm1() {
    state.showCoupon1 = false;
    state.showCoupon2 = true;
    // sheep.$router.go('/pages/inherit/successful');
    // if (!state.orderPayload.address_id && state.orderInfo.need_address === 1) {
    //   sheep.$helper.toast('请选择收货地址');
    //   return;
    // }
    //
    // if (exchangeNow.value) {
    //   uni.showModal({
    //     title: '提示',
    //     content: '确定使用积分立即兑换?',
    //     cancelText: '再想想',
    //     success: async function(res) {
    //       if (res.confirm) {
    //         submitOrder();
    //       }
    //     },
    //   });
    // } else {
    //   submitOrder();
    // }
  }
  function onConfirm2() {
    state.showCoupon = false;
    // sheep.$router.go('/pages/inherit/successful');
    // if (!state.orderPayload.address_id && state.orderInfo.need_address === 1) {
    //   sheep.$helper.toast('请选择收货地址');
    //   return;
    // }
    //
    // if (exchangeNow.value) {
    //   uni.showModal({
    //     title: '提示',
    //     content: '确定使用积分立即兑换?',
    //     cancelText: '再想想',
    //     success: async function(res) {
    //       if (res.confirm) {
    //         submitOrder();
    //       }
    //     },
    //   });
    // } else {
    //   submitOrder();
    // }
  }

</script>

<style lang="scss" scoped>
  .marketDetail {
    padding: 15px 15px 110px;
    box-sizing: border-box;
    background-color: #090909;


    .product {
      background: #1C1C1E;
      border-radius: 10px;
      padding: 18px 20px 19px;
      box-sizing: border-box;

      .product-t {
        font-weight: 400;
        font-size: 20px;
        color: #FFFFFF;
        margin-bottom: 14.5px;
      }

      .product-b {
        font-weight: 400;
        font-size: 14px;

        .text-1 {
          color: #939393;
        }

        .text-2 {
          color: #13C093;
        }

        view {

        }
      }
    }

    .issuer {
      background: #1C1C1E;
      border-radius: 10px;
      padding: 14px 15px;
      box-sizing: border-box;
      height: 70px;
      margin: 10px 0;

      .issuer-l {
        width: 43px;
        height: 43px;
        border-radius: 50%;
        margin-right: 9px;
      }

      .issuer-r {
        .text-1 {
          font-weight: 400;
          font-size: 16px;
          color: #FFFFFF;
          margin-bottom: 6px;
        }

        .text-2 {
          font-weight: 400;
          font-size: 10px;
          color: #888888;
        }
      }
    }

    .transaction {
      background: #1C1C1E;
      border-radius: 10px;
      padding: 14px 15px;
      box-sizing: border-box;
      height: 70px;
      margin: 10px 0;

      .transaction-r {
        width: 5px;
        height: 9px;
      }

      .transaction-l {
        .transaction-l-img {
          width: 13.5px;
          height: 11.5px;
          margin-right: 12px;
        }

        font-weight: 400;
        font-size: 15px;
        color: #FFFFFF;
      }
    }

    .product-content {
      background: #1C1C1E;
      border-radius: 10px;
      padding: 24px 15px;
      box-sizing: border-box;

      .tab {
        padding: 0 4px;
        box-sizing: border-box;
        font-weight: 400;
        font-size: 18px;
        color: #FFFFFF;
        margin-bottom: 25px;

      }

      .productDetails {
        image {
          width: 100%;
        }
      }
    }
  }

  .commodity {
    width: 100%;
    height: 375px;
  }

  .marketDetail-footer {
    padding: 14px 30px;
    box-sizing: border-box;
    background: #151515;

    .footer-left {
      button {
        width: 120px;
        height: 38px;
        line-height: 38px;
        text-align: center;
        border-radius: 19px;
        border: 1px solid #FFFFFF;
        font-weight: 500;
        font-size: 16px;
        color: #FFFFFF;
        background-color: transparent;
      }
    }

    .footer-right {
      button {
        width: 120px;
        height: 38px;
        line-height: 38px;
        text-align: center;
        border-radius: 19px;
        font-weight: 500;
        font-size: 16px;
        color: #FFFFFF;
        background: linear-gradient(90deg, #45C9F0, #36F6AF);
      }
    }
  }


</style>
